package com.study.jyg.rxjava2study.activity.mywidget;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.study.jyg.rxjava2study.R;
import com.study.jyg.rxjava2study.activity.AutoVerticalTextviewActivity;
import com.study.jyg.rxjava2study.activity.CircleScaleViewActivity;
import com.study.jyg.rxjava2study.activity.DropdownViewActivity;
import com.study.jyg.rxjava2study.activity.LineChartActivity;
import com.study.jyg.rxjava2study.activity.LineChartActivity2;
import com.study.jyg.rxjava2study.activity.MyWatchActivity;
import com.study.jyg.rxjava2study.activity.ViewPagerActivity;
import com.study.jyg.rxjava2study.activity.ZhuZhuangTuActivity;
import com.study.jyg.rxjava2study.base.BasicActivity;
import com.study.jyg.rxjava2study.utils.AdapterInit;

import java.util.Arrays;

import butterknife.BindView;

public class MyWidgetActivity extends BasicActivity {


    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;

    private BaseQuickAdapter<String, BaseViewHolder> adapter;
    private String[] strs = {"带progressbar的button","带指示器的viewpager","自定义表盘","折线图","占比图",
            "下拉抽屉","雷达", "上下滚动的textview", "柱状图"};

    @Override
    protected int getLayout() {
        return R.layout.activity_my_widget;
    }

    @Override
    protected void initView() {
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(v -> finish());
        adapter = AdapterInit.initRecyclerView(recyclerView, R.layout.item_recyclerview_textview, Arrays.asList(strs), new LinearLayoutManager(mContext), (helper, item) -> {
            helper.setText(R.id.tvItem, item);
        }, (adapter1, view, position) -> {
            switch (position){
                case 0://
                    startActivity(ProgressButtonActivity.class);
                    break;
                case 1://带指示器的viewpager
                    startActivity(ViewPagerActivity.class);
                    break;
                case 2://表盘
                    startActivity(MyWatchActivity.class);
                    break;
                case 3://折线图
//                    startActivity(LineChartActivity.class);
                    startActivity(LineChartActivity2.class);
                    break;
                case 4://占比图
                    startActivity(CircleScaleViewActivity.class);
                    break;
                case 5://下拉抽屉
                    startActivity(DropdownViewActivity.class);
                    break;
                case 6:
                    startActivity(ScanViewActivity.class);
                    break;
                case 7:
                    startActivity(AutoVerticalTextviewActivity.class);
                    break;
                case 8:
                    startActivity(ZhuZhuangTuActivity.class);
                    break;
            }
        });

    }

}
